import xlrd
import sys
import datetime

class read_excel:

    def __init__(self, input_file):
        self.input_file = input_file
        self.yesterday = (datetime.datetime.now() + datetime.timedelta(days=-1)).strftime('%Y-%m-%d')

    def exec_main(self):

        # 打开文件
        workBook = xlrd.open_workbook(self.input_file)

        # 按索引号获取sheet内容
        sheet1_content1 = workBook.sheet_by_index(0)  # sheet索引从0开始

        cols = sheet1_content1.col_values(0)
        cols1 = sheet1_content1.col_values(1)
        cols7 = sheet1_content1.col_values(6)
        sum_cost = 0
        for i in (list(zip(cols, cols1, cols7))):
            if i[0] == self.yesterday and '多彩' in i[1]:
                print(i)
                sum_cost += i[2]

        return int(sum_cost*100)


